<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>navigator对象</title>
</head>
<body>
    <script type="text/javascript">
        console.log(navigator.plugins);

        function hasPlugin(name){
            // 如果有插件,返回true,反之亦然.
            var name = name.toLowerCase();
            for(var i = 0; i < navigator.plugins.length; i++){
                if(navigator.plugins[i].name.toLowerCase().indexOf(name) > -1){
                    // 有此插件
                    return true;
                }else{
                    return false;
                }
            }
        }
        alert(hasPlugin('Flash'));
        alert(hasPlugin('Chrome PDF Plugin'));
    </script>
</body>
</html>